<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<title>产品管理--产品分类</title>
		<link href="css/common.css" rel="stylesheet" type="text/css" />
		<link href="css/normolize.css" rel="stylesheet" type="text/css" />
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<!--[if IE 9]> <link href="css/ieHack9.css" rel="stylesheet" type="text/css" /> <![endif]-->
		<!--[if IE 8]> <link href="css/ieHack.css" rel="stylesheet" type="text/css" /><link href="css/ieHack8.css" rel="stylesheet" type="text/css" /> <![endif]-->
		<!--[if lte IE 7]> <link href="css/ieHack.css" rel="stylesheet" type="text/css" /> <![endif]-->
		<style>
			.table table>tbody>tr>td { text-align: left; }  .btn { color: #ccc; }  .disabled { color: #666; }  .btn:hover { background: #fff; color: #ccc; }  .btn.blue:hover { color: #fff; }  .btn.disabled:hover { color: #666; }  .table { overflow: visible; padding-left: 40px; background: #eee; margin-bottom: 0px; }  .catelist .title { height: 40px; line-height: 40px; cursor: pointer;border-bottom:1px solid #ddd; }  .table table { margin-top: 0px; margin-bottom: 0px; }  i.icon.icon_delete, i.icon.icon_edit { height: 40px; }  i.icon.icon_edit { background-position: -179px -8px; margin-right: 10px; }  i.icon.icon_delete { background-position: -179px -49px; }  .cate_container { border: 1px solid #ddd; margin-top: 10px; position: relative; margin-bottom: 64px;border-bottom:none; }  .caret { border-top: 4px solid #666; margin-left: 29px; margin-right: 6px; }  .caret.right { border-top: 4px solid transparent; border-left: 4px solid #666; margin-top: -2px; }
		   .table table{border-top:none;border-bottom:none;}
		</style>
		<style>

		</style>
	</head>

	<body>
		<script src="js/tpl/header.js" type="text/javascript" charset="utf-8"></script>
		<div class="page-wrapper productlist minwidth border" id="page-wrapper">
			<div class="line"></div>
			<script src="js/tpl/menu.js" type="text/javascript" charset="utf-8"></script><div class="vertival-line"></div>
			<div class="page-content">
				<div class="tablist">
					<ul>
						<li class="tabItem "><a href="productManage.html#productManage">产品列表</a></li>
						<li class="tabItem active"><a href="productCategory.html#productManage">产品分类</a> </li>
					</ul>
				</div>

				<div class="page-container">
					<div class="page-form" style="margin-top:20px;">
						<div class="clearfix">
							<span class="btn blue addCate fr"><i class="icon icon_add blue"></i> 添加分类</span>
							<span class="btn editCategroup  fl" ><i class="icon icon_group "></i>批量修改</span>
							<div class="inline-block none editCategroupSelect">
								<div class="overlay groupselect" data-proId='1' data-oriCateid='1' style="margin:4px 10px 0px 10px;">
									<!--这个是用来存放选中的select的值的-->
									<input type="hidden" value="" class="form-select-value" />
									<div class="dropdown">
										<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									 	</button>
										<ul class="none">
											<li data-value='1'>红酒</li>
											<li data-value='2'>白酒</li>
											<li data-value='3'>黄酒</li>
											<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
										</ul>
									</div>
								</div>
								<input type="button" class="search-input-button bgblue border-radius" style="margin-top:4px" value="确定">
							</div>

						</div>
						<div class="clearfix"></div>
						<div class="cate_container">
							<div style="height:100%;width:9px;background:#1488b3;position:absolute;top:0;bottom:0;left:0;"></div>
							<div class="catelist">
								<div>
									<div class="title" data-cateId='1'>
										<span class="caret"></span> <span class="catename">红酒</span>
										<div class="fr" style="margin-right:40px;">
											<i class="icon icon_edit" data-cateId='1' data-catename='红酒'></i>
											<i class="icon icon_delete" data-cateId='1' data-catename='红酒'></i>
										</div>

									</div>
									<div class="table none" style="">
										<table>
											<thead>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input checkAll" id="checkAll" />
															<label for="checkAll" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>全选</span>
													</td>
												</tr>
											</thead>
											<tbody>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_1" />
															<label for="checkbox_1" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 05</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='1' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_2" />
															<label for="checkbox_2" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 04</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='6' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_3" />
															<label for="checkbox_3" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 03</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='5' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>

											</tbody>
										</table>
									</div>

								</div>
								<div  class="clearfix">
									<div class="title" data-cateId='2'>
										<span class="caret"></span> <span class="catename">白酒</span>
										<div class="fr" style="margin-right:40px;">
											<i class="icon icon_edit" data-cateId='2' data-catename='白酒'></i>
											<i class="icon icon_delete" data-cateId='2' data-catename='白酒'></i>
										</div>

									</div>
									<div class="table none" style="">
										<table>
											<thead>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input checkAll" id="checkAll_1" />
															<label for="checkAll_1" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>全选</span>
													</td>
												</tr>
											</thead>
											<tbody>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_5" />
															<label for="checkbox_5" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 02</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='4' data-oriCateid='2' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_6" />
															<label for="checkbox_6" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 01</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='3' data-oriCateid='2' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_7" />
															<label for="checkbox_7" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 06</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='2' data-oriCateid='2' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle aaa form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>

											</tbody>
										</table>
									</div>

								</div>
								<div  class="clearfix">
									<div class="title" data-cateId='4'>
										<span class="caret  hidden"></span> <span class="catename">abc酒</span>
										<div class="fr" style="margin-right:40px;">
											<i class="icon icon_edit" data-cateId='4' data-catename='abc酒'></i>
											<i class="icon icon_delete" data-cateId='4' data-catename='abc酒'></i>
										</div>

									</div>
									<div class="table none" style="">
										<table>
											<thead>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input checkAll" id="checkAll" />
															<label for="checkAll" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>全选</span>
													</td>
												</tr>
											</thead>
											<tbody>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_1" />
															<label for="checkbox_1" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 05</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='1' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_2" />
															<label for="checkbox_2" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 04</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='6' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_3" />
															<label for="checkbox_3" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 03</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='5' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>

											</tbody>
										</table>
									</div>

								</div>
								
								<div  class="clearfix">
									<div class="title" data-cateId='3'>
										<span class="caret  hidden"></span> <span class="catename">黄酒</span>
										<div class="fr" style="margin-right:40px;">
											<i class="icon icon_edit" data-cateId='3' data-catename='黄酒'></i>
											<i class="icon icon_delete" data-cateId='3' data-catename='黄酒'></i>
										</div>

									</div>
									<div class="table none" style="">
										<table class="none nonetable">
											<thead>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input checkAll" id="checkAll_2" />
															<label for="checkAll_2" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>全选</span>
													</td>
												</tr>
											</thead>
											<tbody></tbody>
										</table>
									</div>

								</div>
								
								<div  class="clearfix">
									<div class="title" data-cateId='5'>
										<span class="caret  hidden"></span> <span class="catename">r酒</span>
										<div class="fr" style="margin-right:40px;">
											<i class="icon icon_edit" data-cateId='5' data-catename='r酒'></i>
											<i class="icon icon_delete" data-cateId='5' data-catename='r酒'></i>
										</div>

									</div>
									<div class="table none" style="">
										<table>
											<thead>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input checkAll" id="checkAll" />
															<label for="checkAll" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>全选</span>
													</td>
												</tr>
											</thead>
											<tbody>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_1" />
															<label for="checkbox_1" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 05</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='1' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_2" />
															<label for="checkbox_2" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 04</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='6' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>
												<tr>
													<td style="width:41px;">
														<div class="checkbox inline-block">
															<input type="checkbox" value="" class="label-input" id="checkbox_3" />
															<label for="checkbox_3" class="input-label"></label>
														</div>

													</td>
													<td>
														<span>帕克庄园10010 [精装版] 03</span>
													</td>
													<td>
														<div class="overlay fr" data-proId='5' data-oriCateid='1' style="margin-right:80px;">
															<!--这个是用来存放选中的select的值的-->
															<input type="hidden" value="" class="form-select-value" />
															<div class="dropdown">
																<button class="dropdown-toggle form-dropdown" type="button">
									                                <span class="value">全部类型</span>
									                                <span class="caret"></span>
									                            </button>
																<ul class="none">
																	<li data-value='1'>红酒</li>
																	<li data-value='2'>白酒</li>
																	<li data-value='3'>黄酒</li>
																	<li data-value='4'>adc酒</li>
											<li data-value='5'>r酒</li>
											<li data-value='7'>r445酒</li>
											<li data-value='8'>766酒</li>
																</ul>
															</div>
														</div>
													</td>

												</tr>

											</tbody>
										</table>
									</div>

								</div>

							</div>
						</div>
					</div>

				</div>

			</div>
		</div>

		<div class="footer">
			<div class="footercontainer">
				<ul>
					<li>
						<a href="#">关于我们</a>
					</li>
					<li>
						<a href="#">服务与支持</a>
					</li>
					<li>
						<a href="#">常见问题</a>
					</li>
					<li>
						<a href="#">人才招聘</a>
					</li>
					<li>
						<a href="#">加盟合作</a>
					</li>
				</ul>

				<div style="margin-top:13px;">版权所有@ 2015 - 2016 深圳在乎传媒科技有限公司 粤ICP备15107022-1号</div>
			</div>

		</div>

		<!--这里是删除产品的弹框（无法删除）-->

	</body>

	<script src="js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/js.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/layer/layer.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/scroll/jquery.slimscroll.min.js" type="text/javascript" charset="utf-8"></script>
	<script>
		$(function() {
			checkboxTable();
			/*selectObj.changeEvent(selectCallback, $('.table tr')); //下拉框的操作
			selectObj.changeEvent('', $('.groupselect')); //下拉框的操作*/
			selectObj.showChangeValue();
			
			//这里是分类下拉
			$('.title').each(function() {
				$(this).click(function() {
					$(this).find('.caret ').toggleClass('right');
					$(this).next('.table').toggleClass('none');
				})
			})
			addCateLayer(); //添加类别
			editLayer(); //修改类别
			deleteLayer(); //删除类别
			groupFun(); //批量修改

		});

		function groupFun() {
			//批量修改-- 显示批量修改的下拉框
			showGroupSelect();
			//批量修改-- 点击确定移动产品位置
			ajaxGroupSelect();
		}
		//批量修改-- 点击确定移动产品位置
		function ajaxGroupSelect() {
			$('.editCategroupSelect .search-input-button').click(function() {
				$('.editCategroupSelect').addClass('none');
				var cateId = $(this).prev().find('.form-select-value').val(); //要转移的新cateId
				var checkArray = new Array(),
					key = 0,
					selectTitleObj; //放置产品的数组，要移动到的对象
				$('.title').each(function() {
					var self = this;
					//获取要转移的产品数组和要转移到的类别对象
					if((parseInt($(self).attr('data-cateId')) != parseInt(cateId))) {
						var checkedLen=$(self).next().find('input:checkbox:checked').length;
						var checkboxlen=$(self).next().find('input:checkbox').length;
						console.log(checkedLen+" "+checkboxlen);
						if(checkedLen==checkboxlen){
							$(this).next().find('input.checkAll').parent().parent().parent().hide();
							$(this).find('.caret').addClass('hidden');
						}
						$(self).next().find('input:checkbox:checked').each(function() {
							if($(this)[0].checked) {
								if(!$(this).hasClass('checkAll')) {
									var a=$(this).parent().parent().parent().clone();
									var ulHtml=$(a).find('ul');
									a.find('.slimScrollDiv').remove();
									a.find('.dropdown').append(ulHtml);
									console.log(a);
									
									$(a).find('.overlay ul').slimScroll({
										color: 'rgba(0,0,0,0.8)',
										size: '5px',
										height: '100px',
										width: '100%',
										alwaysVisible: true,
										borderRadius: '0px', //滚动条圆角
									});
									$(a).find('.overlay').attr('data-oriCateid',cateId);
								    checkArray[key]=$(a);
								    
									$(this).parent().parent().parent().remove();
								}
								++key;
							}
						});
					} else {
						selectTitleObj = $(self);
					}
				})

				//这里是将产品数组加入到对应的类别对象中去
				groupGotoCate(checkArray, selectTitleObj);
				//复原所有checkbox的选中状态
				$('input:checkbox').each(function() {
					$(this)[0].checked = false;
					$(this).parent().removeClass('checked_checkbox');
				});

			});
		}
		//显示批量转移下拉框		
		function showGroupSelect() {
			$('input:checkbox').click(function() {
				var checkcount = 0;
				$('input:checkbox').each(function() {
					if($(this).attr('checked') == 'checked') {
						++checkcount;
					}
				});
				if(checkcount > 0) {
					$('.editCategroup').addClass('disabled');
					$('.editCategroup').on('click', groupeditFun);
				} else {
					$('.editCategroup').removeClass('disabled');
					$('.editCategroup').off('click', groupeditFun);
					$('.editCategroupSelect').addClass('none');
				}

			})

		}
		//批量修改显示select下拉
		function groupeditFun() {
			$('.editCategroupSelect').removeClass('none');
		}
		
		//这里是将产品数组加入到对应的类别对象中去  操作应该在这个里面进行
		function groupGotoCate(checkArray, selectTitleObj) {
			for(var i = 0; i < checkArray.length; i++) {
				$(selectTitleObj).next().find('tbody').append(checkArray[i]);
				checkboxTable();
				selectObj.changeEvent(selectCallback,$(checkArray[i])); //下拉框的操作
			}
			var tableObj = $(selectTitleObj).next().find('table');
			//判断是否含有table
			if($(tableObj).hasClass('nonetable')) {
				$(tableObj).removeClass('none');
				$(tableObj).removeClass('nonetable');
			}
			$(selectTitleObj).find('.caret').removeClass('hidden');
			$(tableObj).find('input.checkAll').parent().parent().parent().show();
			$(tableObj).parent().removeClass('none');
			
			
		}
		
		
		//单个产品的转移方法		
		function ajaxSelext(_self, changeId) {
			var proID = $(_self).attr('data-proId'); //产品ID
			var oriCateid = $(_self).attr('data-oriCateid'); //产品原先的类别ID
			var cloneTr = ''; //复制要转移的tr对象
			$('.title').each(function() {
				
				
				if((parseInt($(this).attr('data-cateId')) == parseInt(changeId)) && (parseInt(changeId) != parseInt(oriCateid))) {
					cloneTr = $(_self).parent().parent().clone();
					var ulHtml=$(_self).parent().parent().find('ul');
					cloneTr.find('.slimScrollDiv').remove();
					cloneTr.find('.dropdown').append(ulHtml);
					$(cloneTr).find('.overlay').attr('data-oriCateid',changeId);
					$(cloneTr).find('.overlay ul').slimScroll({
				color: 'rgba(0,0,0,0.8)',
				size: '5px',
				height: '100px',
				width: '100%',
				alwaysVisible: true,
				borderRadius: '0px', //滚动条圆角
			});

					
					$(_self).parent().parent().remove(); //删除当前对象

					var tableObj = $(this).next().find('table');
					//判断是否含有table
					if($(tableObj).hasClass('nonetable')) {
						$(tableObj).removeClass('none');
						$(tableObj).removeClass('nonetable');
					}
					$(tableObj).parent().removeClass('none');

					$(this).next().find('tbody').append(cloneTr);
					checkboxTable();
					selectObj.changeEvent(selectCallback, cloneTr); //下拉框的操作
				}
			})
		}
		/*单个的转移  
		 * changeId产品转移到的新的ID
		 */
		function selectCallback(data, changeId) {
			ajaxSelext(data, changeId);
			//			$.ajax({
			//				type: 'POST',
			//				url: '',
			//				data: '',
			//				success:function(data){
			//					 //这里做转移分类的操作
			//                    ajaxSelext(data,changeId); 
			//				},
			//				dataType:"json",
			//			});
		}
		

		//这个是复选框的check函数 程序直接调用就行了
		function checkboxTable() {
			var checkAllobj, checklistObj;
			$('.table').find('table').each(function() {
				checkAllobj = $(this).find("thead .checkbox input:checkbox");
				checklistObj = $(this).find("tbody .checkbox input:checkbox");
				checkBoxFun(checkAllobj, checklistObj); //复选框操作
			})
		}

		//-----------------------这里都是页面弹框的操作了--------------------------
		function addCateLayer() {
			$('.addCate').click(function() {
				layer.open({
					type: 2,
					title: '添加分类',
					shadeClose: true,
					shade: 0.8,
					area: ['400px', '180px'],
					content: 'editCateName.html',
					success: function(layero, index) {
						var body = layer.getChildFrame('body', index);
						var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
						//给父页面传值
						body.find('#subButton').on('click', function() {
							//这里是根据ID修改名称
							var name = body.find('.cate_name').val();
							layer.close(index);
							window.location.reload();
						});

						body.find("#cancelButton").on('click', function() {
							layer.close(index);
						});

					}
				});
			});

		}

		function editLayer() {
			$('.icon_edit').click(function() {
					var _obj = this;
					var id = $(_obj).attr('data-cateId');
					layer.open({
						type: 2,
						title: '修改分类名称',
						shadeClose: true,
						shade: 0.8,
						area: ['400px', '180px'],
						content: 'editCateName.html',
						success: function(layero, index) {

							var body = layer.getChildFrame('body', index);
							var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();

							body.find('.cate_name').val($(_obj).attr('data-catename'));

							//给父页面传值
							body.find('#subButton').on('click', function() {
								//这里是根据ID修改名称
								var name = body.find('.cate_name').val();

								editName(layer, index, id, name, _obj);
							});

							body.find("#cancelButton").on('click', function() {
								layer.close(index);
							});

						}
					});
			})

			}

			function deleteLayer() {
				$('.icon_delete').click(function() {
					var _obj = this;
					var id = $(this).attr('data-cateId');
					layer.open({
						type: 2,
						title: '删除',
						shadeClose: true,
						shade: 0.8,
						area: ['400px', '180px'],
						content: 'confirmDelete.html',
						success: function(layero, index) {

							var body = layer.getChildFrame('body', index);
							var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
							body.find('.title').html('确定删除该类别?');
							body.find('.deleteId').val(id);

							//给父页面传值
							body.find('#subButton').on('click', function() {
								deleteCate(index, layer, id, _obj);
							});

							body.find("#cancelButton").on('click', function() {
								layer.close(index);
							});

						}
					});
				})

			}
			//修改产品名称
			function editName(layer, index, id, name, editobj) {

				//			console.log(name);
				$(editobj).parent().prev('.catename').html(name);
				layer.close(index);
				//			$.ajax({
				//				type: 'POST',
				//				url: '',
				//				data: '',
				//				success:function(data){
				//					layer.close(index);
				//				},
				//				dataType:"json",
				//			});

			}
			//删除产品名称
			function deleteCate(index, layer, id, deleteobj) {
				layer.close(index);
				$(deleteobj).parent().parent().parent().remove();
				//			$.ajax({
				//				type: 'POST',
				//				url: '',
				//				data: '',
				//				success:function(data){
				//					layer.close(index);
				//				},
				//				dataType:"json",
				//			});
			}
	</script>

</html>